/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <string>
using namespace std;
int main() {
   string a,a1;
   cout << "Выведите скобочну последоватльность"<< endl;
   getline(cin,a);
   for(char b: a){
    if(b == '(' || b == '<'|| b == '[' || b == '{') {
      a1 += b;
    }  
    if(b== ')') {
      if(a1.length() > 0) {
        if(a1[a1.length() - 1] == '(') {
          a1.pop_back();
        }
      }
    }
    if(b == '>') {
      if(a1.length() > 0) {
        if(a1[a1.length() - 1] == '<') {
          a1.pop_back();
        }
      }
    }
    if(b == '{') {
      if(a1.length() > 0) {
        if(a1[a1.length() - 1] == '{') {
          a1.pop_back();  
        }
      }
    }
    if(b == ']') {
      if(a1.length() > 0) {
        if(a1[a1.length() - 1] == '[') {
          a1.pop_back();
        }
      }
    }
  }
  if (a1.length() > 0) {
    cout << "False" << endl;
  }     
  else{
    cout << "True" << endl;  
  }
  return 0;
}